(function() {
    'use strict';

    angular
        .module('milkbeeApp')
        .controller('MyAvatarDialogController', MyAvatarDialogController);

    MyAvatarDialogController.$inject = ['$timeout', '$scope', '$http','$stateParams', '$uibModalInstance', 'entity', 'MyProfile'];

    function MyAvatarDialogController ($timeout, $scope,$http, $stateParams, $uibModalInstance, entity, MyProfile) {
        var vm = this;
        vm.clear = clear;
        vm.save = save;

        $timeout(function (){
            angular.element('.form-group:eq(1)>input').focus();
        });

        function clear () {
            $uibModalInstance.dismiss('cancel');
        }

        function save () {
        }

        function onSaveSuccess (result) {
            $scope.$emit('milkbeeApp:leaguerUpdate', result);
            $uibModalInstance.close(result);
            vm.isSaving = false;
        }

        vm.changeAvatar=function(index){
        	$http({
        		method: 'PUT',
        		url: '/api/my/profile/useavatar/'+index,
        		transformRequest: angular.identity
        	}).success(function(ret){
        		
        	});
        }
    }
})();
